<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="div">
			
		</div>
		
		<script>
			var x = document.getElementById("div");
			function getLocation(){
				if(navigator.geolocation){
					navigator.geolocation.getCurrentPosition(showPosition);
				}else{
					x.innerHTML="该浏览器不支持获取地理位置"
				}
			}
			
			function showPosition(position){
				alert("21")
				x.innerHTML = "纬度: " + position.coords.latiude +
				"<br>经度: "+position.coords.longitude;
			}
			
			getLocation();
		</script>
	</body>
</html>